//
//  DGPiechartViewController.m
//  DGChartDraw
//
//  Created by yidong on 16/11/4.
//  Copyright © 2016年 东哥. All rights reserved.
//

#import "DGPiechartViewController.h"
#import "DGPieChartView.h"

@interface DGPiechartViewController ()


@end

@implementation DGPiechartViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
    
    DGPieChartView *pie = [[DGPieChartView alloc] initWithFrame:CGRectMake(100, 100, 321, 421)];
    pie.center = CGPointMake(CGRectGetMaxX(self.view.frame)/2, CGRectGetMaxY(self.view.frame)/2);
    /* 饼状图数值 会自动根据数值计算百分比 */
    pie.valueArr = @[@18,@10,@25,@40,@18,@10,@25,@40,@18,@10,@15,@12,@30,@18];
    /* 每一个扇形区的描述 必须要填 并且数量必须和饼状图数值个数相同 */
    pie.descArr = @[@"1",@"2",@"第三个元素",@"第四个元素",@"5",@"6",@"7",@"8",@"9",@"10",@"23",@"12",@"21",@"30"];
    pie.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:pie];
    /*        触碰某块饼图时动画偏移值         */
    pie.positionChangeLengthWhenClick = 15;
    /*        动画展示         */
    [pie showAnimation];
}
@end
